home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / imengv3.41p2.lha / ImEngV3.41p2 / Extra / DPaint5 / DP5_Export.rexx next >
OS/2 REXX Batch file  |  1996-10-20  |  2KB  |  77 lines

  1. /*
  2. ** $VER: ADPro_Export 1.0 (20/10 1996 Stockholm/Sweden)
  3. ** Copyright © 1996 by Patrik M Nydensten
  4. **
  5. ** This arexx script will export the PRIMARY image in
  6. ** ImageEngineer to DPaint. Both programs must be running at
  7. ** the same time.
  8. ** This script requires Deluxe Paint 5.0 (or higher)
  9. ** and ImageEngineer 3.0 (or higher).
  10. **
  11. */
  12.  
  13. Options Results
  14. Signal On Error
  15. temp_file = 't:Image_from_IE'
  16.  
  17. if arg()==0 then exit
  18.  
  19. /* Main code */
  20.  
  21. IF ~SHOW(PORTS,'DPAINT.1') THEN DO
  22.      'REQUEST' '"Could not locate arexx port DPAINT.1 !"' '" OK "'
  23.     CALL ErrorOut 10
  24. END
  25.  
  26. 'RENDER' arg(1) 'QUIET'
  27.  
  28. 'SAVE' arg(1) '"'temp_file'"' '"ILBM CmpByteRun1"'
  29. IF (RC ~= 0) THEN DO
  30.      'REQUEST' '"Error when saving temporary image!"' '" OK "'
  31.     CALL ErrorOut 10
  32. END
  33.  
  34. 'RENDER_CLOSE' arg(1)
  35.  
  36. ADDRESS "DPAINT.1"
  37.  
  38. 'SCREENTOFRONT'
  39.  
  40. 'LOADPIC' '"'temp_file'"'
  41. IF (RC ~= 0) THEN DO
  42.   ADDRESS 'IMAGEENGINEER'
  43.   'IE_TO_FRONT'
  44.      'REQUEST' '"Error when loading image into DPaint!"' '" OK "'
  45.     CALL ErrorOut 10
  46. END
  47.  
  48. CALL Errorout 0
  49.  
  50. /* Errorout procedure */
  51.  
  52. ErrorOut:
  53.     PARSE ARG ExitCode
  54.  
  55.     IF (EXISTS( TEMP_FILE )) THEN DO
  56.       ADDRESS COMMAND 'Delete >NIL:' temp_file
  57.   END
  58.   
  59.     EXIT ExitCode
  60.  
  61. /* IE's error procedure */
  62.  
  63. Error:
  64. address 'IMAGEENGINEER'
  65. if RC=5 then do            /* Did the user just cancel us? */
  66.     IE_TO_FRONT
  67.     LAST_ERROR
  68.     'REQUEST "'||RESULT||'"'
  69.     CALL ErrorOut 10
  70. end
  71. else do
  72.     IE_TO_FRONT
  73.     LAST_ERROR
  74.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  75.   CALL ErrorOut 10
  76. end
  77.